<template>
    <el-row class="login-container">
        <el-col :span="9" :style="{ height: screenHeight + 'px'}">
            <div class="text-light-50" :style="{lineHeight:screenHeight + 'px'}">
                <div class="text-xl">
                    欢迎光临XXX关联系统
                </div>
            </div>
        </el-col>
        <el-col :span="15" :style="{ height: screenHeight + 'px'}">
            <h2 class="">欢迎回来</h2>
            <div class="">
                <span class="line"></span>
                <span>后台管理系统</span>
                <span class="line"></span>
            </div>
            <!--            :rules="loginValid" :model="loginForm"-->
            <el-form ref="loginFormRef" class="250px">
                <el-form-item prop="account">
                    <el-input v-model="userName" placeholder="账号">
                        <el-icon class="el-input__icon"></el-icon>
                    </el-input>
                </el-form-item>
                <el-form-item prop="password">
                    <el-input v-model="userPwd" placeholder="密码" type="password">
                        <el-icon class="el-input__icon"></el-icon>
                    </el-input>
                </el-form-item>
                <el-form-item>
                    <el-button type="primary" @click="login">登 录</el-button>
                </el-form-item>
            </el-form>
        </el-col>
    </el-row>
</template>


<script>
export default {
    name: "login",
    data() {
        return {
            userName: "",
            userPwd: "",
            id: null,
            screenHeight: 0, // 屏幕高度
        }
    },
    mounted() {
        this.screenHeight = document.documentElement.clientHeight;
    },
    methods: {
        login() {
            this.$http.post(
                this.$api.adminLogin.url,
                {
                    UserName: this.userName,
                    UserPwd: this.userPwd
                }
            ).then(
                response => {
                    if (response.code == 200) {
                        this.$router.push("/Home/Index");
                    }
                }
            ).catch(
                error => {
                    console.log(error);
                }
            );
        },
        getInfo() {
            this.$http.get(
                "Test/SelectUserInfo",
                {
                    id: this.id
                }
            ).then(
                response => {
                    console.log(response);
                }
            ).catch(
                error => {
                    console.log(error);
                }
            );
        },
        getToken() {
            console.info("获取成功：", storage.get("token"));
        }
    }
}
</script>

<style>
.text-light-50 {
    text-align: center;
}
</style>
